<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emp-toolkit: /Users/wangxiao/git/emp-toolkit/emp-tool/circuits/bit.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo-full-doxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emp-toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('bit_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">bit.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="bit_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef BIT_H__</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define BIT_H__</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="backend_8h.html">backend.h</a>&quot;</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="utils_8h.html">utils.h</a>&quot;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;block.h&quot;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="swappable_8h.html">swappable.h</a>&quot;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="class_bit.html">    8</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_bit.html">Bit</a> : <span class="keyword">public</span> <a class="code" href="class_swappable.html">Swappable</a>&lt;Bit&gt;{ <span class="keyword">public</span>:</div><div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="class_bit.html#a91ecea0b6e1464d2353040bbfa184853">    9</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> <a class="code" href="class_bit.html#a91ecea0b6e1464d2353040bbfa184853">bit</a>;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;    <a class="code" href="class_bit.html#a351d0f0582c40cd783502d017c129e32">Bit</a>(<span class="keywordtype">bool</span> _b = <span class="keyword">false</span>, <span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a> = <a class="code" href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a>);</div><div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="class_bit.html#aeb23d0e805c51ad50d81c22bc1079cf5">   12</a></span>&#160;    <a class="code" href="class_bit.html#aeb23d0e805c51ad50d81c22bc1079cf5">Bit</a>(<span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp; a) {</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;        memcpy(&amp;bit, &amp;a, <span class="keyword">sizeof</span>(<a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>));</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;    }</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> O = <span class="keywordtype">bool</span>&gt; </div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    O <a class="code" href="class_bit.html#a2a79f99742281ad5374dab3c04e75e8e">reveal</a>(<span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a> = <a class="code" href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a>) <span class="keyword">const</span>;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#a0fe8e984e00b19e47ad39463c0e39947">operator!=</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a>&amp; rhs) <span class="keyword">const</span>; </div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#a903cb6304de59d6052bda23cb9d1ca31">operator==</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a>&amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#a0692647b16d3c11c217b4b506c3de1c7">operator &amp;</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a>&amp; rhs) <span class="keyword">const</span>;  </div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#addd311c153d4f79dcac55eb6d0928982">operator |</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a>&amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#a0bfb9bde2d61ca3d981349f84dc07417">operator !</a>() <span class="keyword">const</span>; </div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="comment">//swappable</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#a54d49c4cd833d2671dfc75e462a7953e">select</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a> &amp; <a class="code" href="class_bit.html#a54d49c4cd833d2671dfc75e462a7953e">select</a>, <span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a> &amp; new_v)<span class="keyword">const</span> ;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_bit.html#a2e37289dba24fd82a30e036c4131a5b8">operator ^</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a>&amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <span class="comment">//batcher</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Args&gt;</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="class_bit.html#af88948ab449ec4560054556a03b81e6e">   31</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="class_bit.html#af88948ab449ec4560054556a03b81e6e">bool_size</a>(Args&amp;&amp;... args) {</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    }</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="class_bit.html#a4a486749a90688e308d6dc51fda51285">   35</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_bit.html#a4a486749a90688e308d6dc51fda51285">bool_data</a>(<span class="keywordtype">bool</span> *b, <span class="keywordtype">bool</span> data) {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        b[0] = data;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    }</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="class_bit.html#af0969ef9bf52a976f7c6b5b3cb5c218a">   39</a></span>&#160;    <a class="code" href="class_bit.html#af0969ef9bf52a976f7c6b5b3cb5c218a">Bit</a>(<span class="keywordtype">size_t</span> size, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>* a) {</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;        memcpy(&amp;bit, a, <span class="keyword">sizeof</span>(<a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>));</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    }</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;};</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="bit_8hpp.html">bit.hpp</a>&quot;</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="class_bit_html_a4a486749a90688e308d6dc51fda51285"><div class="ttname"><a href="class_bit.html#a4a486749a90688e308d6dc51fda51285">Bit::bool_data</a></div><div class="ttdeci">static void bool_data(bool *b, bool data)</div><div class="ttdef"><b>Definition:</b> bit.h:35</div></div>
<div class="ttc" id="class_bit_html_a351d0f0582c40cd783502d017c129e32"><div class="ttname"><a href="class_bit.html#a351d0f0582c40cd783502d017c129e32">Bit::Bit</a></div><div class="ttdeci">Bit(bool _b=false, int party=PUBLIC)</div><div class="ttdef"><b>Definition:</b> bit.hpp:1</div></div>
<div class="ttc" id="class_bit_html_a2a79f99742281ad5374dab3c04e75e8e"><div class="ttname"><a href="class_bit.html#a2a79f99742281ad5374dab3c04e75e8e">Bit::reveal</a></div><div class="ttdeci">O reveal(int party=PUBLIC) const</div><div class="ttdef"><b>Definition:</b> bit.hpp:15</div></div>
<div class="ttc" id="class_bit_html_af88948ab449ec4560054556a03b81e6e"><div class="ttname"><a href="class_bit.html#af88948ab449ec4560054556a03b81e6e">Bit::bool_size</a></div><div class="ttdeci">static size_t bool_size(Args &amp;&amp;... args)</div><div class="ttdef"><b>Definition:</b> bit.h:31</div></div>
<div class="ttc" id="bit_8hpp_html"><div class="ttname"><a href="bit_8hpp.html">bit.hpp</a></div></div>
<div class="ttc" id="class_bit_html_af0969ef9bf52a976f7c6b5b3cb5c218a"><div class="ttname"><a href="class_bit.html#af0969ef9bf52a976f7c6b5b3cb5c218a">Bit::Bit</a></div><div class="ttdeci">Bit(size_t size, const block *a)</div><div class="ttdef"><b>Definition:</b> bit.h:39</div></div>
<div class="ttc" id="garble_2block_8h_html_a65abbf31b0a30290189cdb5059b5f785"><div class="ttname"><a href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a></div><div class="ttdeci">__m128i block</div><div class="ttdef"><b>Definition:</b> block.h:8</div></div>
<div class="ttc" id="class_bit_html_a903cb6304de59d6052bda23cb9d1ca31"><div class="ttname"><a href="class_bit.html#a903cb6304de59d6052bda23cb9d1ca31">Bit::operator==</a></div><div class="ttdeci">Bit operator==(const Bit &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> bit.hpp:30</div></div>
<div class="ttc" id="class_bit_html_a0bfb9bde2d61ca3d981349f84dc07417"><div class="ttname"><a href="class_bit.html#a0bfb9bde2d61ca3d981349f84dc07417">Bit::operator!</a></div><div class="ttdeci">Bit operator!() const</div><div class="ttdef"><b>Definition:</b> bit.hpp:53</div></div>
<div class="ttc" id="utils_8h_html_ad17d551e31d1828c68acf40684849b7e"><div class="ttname"><a href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a></div><div class="ttdeci">#define PUBLIC</div><div class="ttdef"><b>Definition:</b> utils.h:14</div></div>
<div class="ttc" id="class_bit_html_aeb23d0e805c51ad50d81c22bc1079cf5"><div class="ttname"><a href="class_bit.html#aeb23d0e805c51ad50d81c22bc1079cf5">Bit::Bit</a></div><div class="ttdeci">Bit(const block &amp;a)</div><div class="ttdef"><b>Definition:</b> bit.h:12</div></div>
<div class="ttc" id="utils_8h_html"><div class="ttname"><a href="utils_8h.html">utils.h</a></div></div>
<div class="ttc" id="class_bit_html_a0fe8e984e00b19e47ad39463c0e39947"><div class="ttname"><a href="class_bit.html#a0fe8e984e00b19e47ad39463c0e39947">Bit::operator!=</a></div><div class="ttdeci">Bit operator!=(const Bit &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> bit.hpp:34</div></div>
<div class="ttc" id="class_swappable_html"><div class="ttname"><a href="class_swappable.html">Swappable</a></div><div class="ttdef"><b>Definition:</b> swappable.h:7</div></div>
<div class="ttc" id="class_bit_html"><div class="ttname"><a href="class_bit.html">Bit</a></div><div class="ttdef"><b>Definition:</b> bit.h:8</div></div>
<div class="ttc" id="class_bit_html_a2e37289dba24fd82a30e036c4131a5b8"><div class="ttname"><a href="class_bit.html#a2e37289dba24fd82a30e036c4131a5b8">Bit::operator^</a></div><div class="ttdeci">Bit operator^(const Bit &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> bit.hpp:43</div></div>
<div class="ttc" id="class_bit_html_a54d49c4cd833d2671dfc75e462a7953e"><div class="ttname"><a href="class_bit.html#a54d49c4cd833d2671dfc75e462a7953e">Bit::select</a></div><div class="ttdeci">Bit select(const Bit &amp;select, const Bit &amp;new_v) const</div><div class="ttdef"><b>Definition:</b> bit.hpp:7</div></div>
<div class="ttc" id="input-check-malicious_8cpp_html_aefdd5aa9f02e7cb8d21ea22b0e6b03df"><div class="ttname"><a href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a></div><div class="ttdeci">int party</div><div class="ttdef"><b>Definition:</b> input-check-malicious.cpp:12</div></div>
<div class="ttc" id="backend_8h_html"><div class="ttname"><a href="backend_8h.html">backend.h</a></div></div>
<div class="ttc" id="swappable_8h_html"><div class="ttname"><a href="swappable_8h.html">swappable.h</a></div></div>
<div class="ttc" id="class_bit_html_a91ecea0b6e1464d2353040bbfa184853"><div class="ttname"><a href="class_bit.html#a91ecea0b6e1464d2353040bbfa184853">Bit::bit</a></div><div class="ttdeci">block bit</div><div class="ttdef"><b>Definition:</b> bit.h:9</div></div>
<div class="ttc" id="class_bit_html_addd311c153d4f79dcac55eb6d0928982"><div class="ttname"><a href="class_bit.html#addd311c153d4f79dcac55eb6d0928982">Bit::operator|</a></div><div class="ttdeci">Bit operator|(const Bit &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> bit.hpp:49</div></div>
<div class="ttc" id="class_bit_html_a0692647b16d3c11c217b4b506c3de1c7"><div class="ttname"><a href="class_bit.html#a0692647b16d3c11c217b4b506c3de1c7">Bit::operator&amp;</a></div><div class="ttdeci">Bit operator&amp;(const Bit &amp;rhs) const</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_eec959d81771dc8b1a750b834e1341eb.html">emp-tool</a></li><li class="navelem"><a class="el" href="dir_2b4671b717884caf3b3fe5ce6896c1bb.html">circuits</a></li><li class="navelem"><a class="el" href="bit_8h.html">bit.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
